{!capture name='main'!}
{!include file='settings/head.tpl' showType='profile'!}
{!/capture!}
{!capture name='left'!}
{!if $typeId == 0!}
	<table cellspacing="4" cellpadding="0" border="0" width="100%">
		{!if $isMyself!}<tr>
			<td class="r" width="60">Email：</td>
			<td>{!$people.email!}</td>
		</tr>
		{!/if!}
		<tr>
			<td class="r" width="60">昵称：</td>
			<td><span class="nickname">{!$people.nickname!}</span></td>
		</tr>
		<tr>
			<td class="r">注册日期：</td>
			<td>{!$people.createTime|date_format:"%Y/%m/%d %H:%M"!}</td>
		</tr>
	</table>
{!elseif $typeId == 1!}
	<script type="text/javascript">
		function onUploadOver() {
			var c = document.getElementById('frmUpload').contentWindow.document.body.innerHTML;
			if (c == "1") {
				frames["frmFace"].location.reload();
				$('#uploadPicture').val('');
				$('#btnUpload').attr('disabled',false);
			}
		}
	</script>
	<form enctype="multipart/form-data" method="post" action="/action/face/modify" target="frmUpload" onsubmit="return onSubmit(this);">
	<input type="hidden" name="MAX_FILE_SIZE" value="2000000"/>
	<table cellspacing="4" cellpadding="0" border="0" width="100%">
		<tr>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td class="r">头像：</td>
			<td><input type="file" name="picture" id="uploadPicture" size="40"/><span class="g">不超过2M</span></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" value="修改" id="btnUpload"/></td>
		</tr>
	</table>
	</form>
	<iframe id="frmUpload" name="frmUpload" frameborder="0"  scrolling="no" style="width:0px;height:0px;" onload="onUploadOver()"></iframe>
{!elseif $typeId == 2!}
	<form method="post" action="/action/password/modify" onsubmit="return onSubmit(this)">
	<table cellspacing="4" cellpadding="0" border="0" width="100%">
		<tr>
			<td class="r" width="60">原密码：</td>
			<td><input type="password" name="oldPassword" style="width:200px;" maxlength="20"/><span class="g">现在使用的密码</span></td>
		</tr>
		<tr>
			<td class="r">新密码：</td>
			<td>
				<input type="password" name="password" style="width:200px;" maxlength="20"/><span class="g">6-20位</span>
			</td>
		</tr>
		<tr>
			<td class="r">密码确认：</td>
			<td>
				<input type="password" name="rePassword" style="width:200px;" maxlength="20"/><span class="g">再输一次密码</span>
			</td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" value="修改"/></td>
		</tr>
	</table>
	</form>
{!/if!}
{!/capture!}
{!capture name='jsCode'!}
{!if $isMyself!}
	<script type="text/javascript">
	function modifyNickname() {
		var _old = $('#nicknameLink').text();
		var _new = prompt("请输入新的昵称", _old);
		if (_new != null && _new != _old) {
			$.post("/action/nickname_modify", {'new':_new}, function(ret){
				if (ret == 1) {
					$('.nickname').text(_new);
				} else {
					alert(ret);
				}
			});
		}
	}
	{!if $typeId == 1!}
	function onSubmit(form) {
		var p = $(form.picture).val();
		if (!$.trim(p)) {
			form.picture.focus();
			return false;
		}
		if (!/\.(gif|jpg)$/i.test(p)) {
			form.picture.select();
			alert("图片必须为gif或者jpg格式");
			return false;
		}
		$('#btnUpload').attr('disabled',true);
		return true;
	}
	
	{!elseif $typeId==2!}
	function onSubmit(form){
		if (!$.trim(form.oldPassword.value)) {
			form.oldPassword.focus();
			alert("原密码不能为空");
			return false;
		}
		var len = $.trim(form.password.value).length;
		if (len < 6 || len > 20) {
			alert("密码长度为6-20位！");
			form.password.focus();
			return false;
		}
		if (form.rePassword.value != form.password.value) {
			alert("两次输入的密码不一致");
			form.password.focus();
			return false;
		}
		if ($.trim(form.oldPassword)==$.trim(form.password.value)) {
			alert("没有对密码进行任何的修改");
			return false;
		}
		return true;
	}
	{!/if!}
	</script>
	{!/if!}
{!/capture!}

{!include file='layouts/default.tpl'!}